package org.ccay.demo.student.service;

import java.util.List;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import org.ccay.core.base.BatchVO;
import org.ccay.core.base.PageVO;
import org.ccay.core.base.PagedResult;
import org.ccay.core.exception.ApplicationException;
import org.ccay.demo.student.StudentVO;
import org.ccay.demo.student.enumerable.HobbyEnum;
import org.ccay.enumerable.EnumItem;
import org.ccay.security.annotation.SecurityOperation;
import org.ccay.security.annotation.SecurityPolicy;
import org.ccay.security.annotation.SecurityResource;

/**
 * 
 * 测试--学生Service接口
 * @author chaowangbang
 * @since 2012-8-23
 */
@Path("/student")
@Produces("application/json")
@SecurityResource(code="studentManagement",name="系统演示|学生管理",desc="系统演示->学生管理")
public interface IStudentService {

	/**
	 * 分页查找学生信息
	 * @param queryStudent 查询条件
	 * @param pageVO 分页信息
	 * @return
	 */
	@GET
	@Path("list/page/filter/{pageSize}/{curPage}/{filterStr}")
	@SecurityOperation(code="query",name="查询",policy=SecurityPolicy.AllLogonUser)
	PagedResult<StudentVO> findPagedStudentListFilter(@QueryParam("") StudentVO queryStudent, @PathParam("") PageVO pageVO);
	
	/**
	 * 分页查找学生信息
	 * @param queryStudent 查询条件
	 * @param pageVO 分页信息
	 * @return
	 */
	@GET
	@Path("list/page/{pageSize}/{curPage}")
	@SecurityOperation(code="list",name="学生信息列表",policy=SecurityPolicy.AllLogonUser)
	PagedResult<StudentVO> findPagedStudentList(@QueryParam("") StudentVO queryStudent, @PathParam("") PageVO pageVO);
	
	@GET
	@Path("list/page/mode/{pageSize}/{curPage}/{resultMode}")
	@SecurityOperation(code="query",name="查询",policy=SecurityPolicy.AllLogonUser)
	PagedResult<StudentVO> findModePagedStudentList(@QueryParam("") StudentVO queryStudent, @PathParam("") PageVO pageVO);
	
	@GET
	@Path("list/page/filterMode/{pageSize}/{curPage}/{resultMode}/{filterStr}")
	@SecurityOperation(code="query",name="查询",policy=SecurityPolicy.AllLogonUser)
	PagedResult<StudentVO> findFilterModePagedStudentList(@QueryParam("") StudentVO queryStudent, @PathParam("") PageVO pageVO);
	
	/**
	 * 测试通过路径方式接收EnumItem
	 * @param pageVO
	 * @return
	 */
	@GET
	@Path("/testEnumItemPathParams/{hobby}")
	EnumItem<HobbyEnum> testEnumItemPathParams(@PathParam("hobby") EnumItem<HobbyEnum> hobby);
	
	
	/**
	 * 测试通过路径方式接收EnumItem
	 * @param pageVO
	 * @return
	 */
	@GET
	@Path("/testEnumItemPathParams2/{hobby}")
	StudentVO testEnumItemPathParams2(@PathParam("") StudentVO student);
	
	
	/**
	 * 通过排序分页查找学生信息
	 * @param taxis 排序字段，如：age desc或者age asc
	 * @param pageVO
	 * @return
	 */
	@GET
	@Path("/list/page/{pageSize}/{curPage}/{orderBy}")
	@SecurityOperation(code="query",name="查询",policy=SecurityPolicy.AllLogonUser)
	PagedResult<StudentVO> findPagedStudentListBySort(@QueryParam("") StudentVO queryStudent, @PathParam("") PageVO pageVO, @QueryParam("sort") String taxis);
	
	/**
	 * 查询单个学生信息
	 * @param studentVO
	 * @return
	 * @throws ApplicationException
	 */
	@GET
	@Path("/single/{id}")
	@SecurityOperation(code="query",name="查询",policy=SecurityPolicy.AllLogonUser)
	StudentVO findStudentByID(@PathParam("") StudentVO studentVO) throws ApplicationException;
	
	/**
	 * 通过ID查找学生信息	
	 * @param studentId
	 * @return
	 */
	@POST
	@Path("/list")
	@SecurityOperation(code="query",name="查询",policy=SecurityPolicy.AllLogonUser)
	List<StudentVO> findStudentListByID(List<Integer> studentId);
	
	/**
	 * 增加单个学生信息	
	 * @param newStudent
	 * @throws ApplicationException
	 */
	@POST
	@Path("/single")
	@SecurityOperation(code="create",name="添加",policy=SecurityPolicy.AllLogonUser)
	void createStudent(StudentVO newStudent) throws ApplicationException;
	
	/**
	 * 批量增加学生信息
	 * @param newStudents
	 * @throws ApplicationException
	 */
	@SecurityOperation(code="create",name="添加",policy=SecurityPolicy.AllLogonUser)
	void createStudents(List<StudentVO> newStudents) throws ApplicationException;
	
	/**
	 * 删除单个学生信息
	 * @param existedStudent
	 * @throws ApplicationException
	 */
	@DELETE
	@Path("/single/{id}")
	@SecurityOperation(code="delete",name="删除",policy=SecurityPolicy.AllLogonUser)
	void deleteStudent(@PathParam("id") Integer studentId) throws ApplicationException;
	
	/**
	 * 批量删除学生信息
	 * @param existedStudents
	 * @throws ApplicationException
	 */
	@PUT
	@Path("/delete")
	@SecurityOperation(code="delete",name="删除",policy=SecurityPolicy.AllLogonUser)
	void deleteStudents(List<StudentVO> existedStudents) throws ApplicationException;
	
	/**
	 * 修改单个学生信息
	 * @param existedStudent
	 * @throws ApplicationException
	 */
	@PUT
	@Path("/single")
	@SecurityOperation(code="update",name="修改",policy=SecurityPolicy.AllLogonUser)
	void updateStudent(StudentVO existedStudent) throws ApplicationException;
	
	/**
	 * 批量修改学生信息
	 * @param existedStudents
	 * @throws ApplicationException
	 */
	@SecurityOperation(code="update",name="修改",policy=SecurityPolicy.AllLogonUser)
	void updateStudents(List<StudentVO> existedStudents) throws ApplicationException;
	
	/**
	 * 批量操作学生信息
	 * @param batchItems
	 * @throws ApplicationException
	 */
	@PUT
	@Path("/batch")
	@SecurityOperation(code="batch",name="批量操作",policy=SecurityPolicy.AllLogonUser)
	void batchOperation(BatchVO<StudentVO> batchItems) throws ApplicationException;
	
	/**
	 * 通过学生ID集合批量删除学生信息
	 * @param studentIds
	 * @throws ApplicationException
	 */
	@SecurityOperation(code="delete",name="删除",policy=SecurityPolicy.AllLogonUser)
	void deleteStudentsBySIds(List<Integer> studentIds) throws ApplicationException;
	
	/**
	 * 查找时间列表
	 * @return
	 */
	@GET
	@Path("/list/time/{filterStr}")
	@SecurityOperation(code="query",name="查询",policy=SecurityPolicy.AllLogonUser)
	PagedResult<StudentVO> findTimeList(@PathParam("") PageVO pageVO) throws ApplicationException;
}
